<?php

namespace App\Kuafu\User\Controller\Internal;

use App\Exceptions\BaseException;
use App\Exceptions\CustomValidateException;
use App\Kuafu\Base\Controller\BaseController;
use App\Kuafu\Common\Enum\CodeEnum;
use App\Kuafu\User\Model\Permissions;
use App\Kuafu\User\Service\AuthService;
use App\Kuafu\User\Service\CacheService;
use App\Kuafu\User\Service\PermissionsService;
use App\Kuafu\User\Service\UserRoleService;
use App\Kuafu\User\Validate\CacheValidate;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\SimpleCache\InvalidArgumentException;

class CacheController extends BaseController
{

    /**
     * 移除rms缓存-
     *
     * @param Request $request
     * @return JsonResponse
     * @throws BaseException
     * @throws CustomValidateException
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     * @throws InvalidArgumentException
     */
    public function rmCache(Request $request): JsonResponse
    {
        $params = CacheValidate::rmCacheKeyValidate($request->all());
        return $this->success(CacheService::rmCache($params));
    }

}
